namespace Terra.Core.Common.Exceptions;

using Terra.Core.Common.ErrorCodes.Models;

/// <summary>
/// 框架异常基类
/// </summary>
public class BaseException : Exception
{
    /// <summary>
    /// 错误码
    /// </summary>
    public string Code { get; set; } = string.Empty;

    /// <summary>
    /// 错误消息
    /// </summary>
    public override string Message { get; }

    /// <summary>
    /// 错误级别
    /// </summary>
    public ErrorSeverity Severity { get; set; } = ErrorSeverity.Error;

    public BaseException(string message = "服务器错误")
        : base(message)
    {
        Message = message;
    }

    public BaseException(string message, Exception innerException)
        : base(message, innerException)
    {
        Message = message;
    }
}